import { Routes, Route  } from "react-router-dom";
import RoutesList from "./routes";
import React from "react";

const Router: React.FC = () => {
  return (
    <Routes>
      {RoutesList.map((v, i) => {
        if (v.meta.cache) {
          return <Route key={i} path={v.path} element={v.element}></Route>;
        } else {
          return <Route key={i} path={v.path} element={v.element}></Route>;
        }
      })}
    </Routes> 
  );
};

export default Router;

// react + ts 实现函数组件内的数据缓存